class Velocity2 extends egret.DisplayObjectContainer {
    private ball:Ball
    private vx:number = 5
    private vy:number = 5

    public constructor() {
        super()
        this.once( egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
    }

    private onAddToStage(event:egret.Event) {
        this.ball = new Ball()
        this.addChild(this.ball)
        this.ball.x = 50
        this.ball.y = 100
        this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
    }

    private onEnterFrame(event:egret.Event) {
        this.ball.x += this.vx
        this.ball.y += this.vy
    }
}